import request from '@/utils/request'

// 查询报表世界数据地图列表
export function listDatamap(query) {
  return request({
    url: '/reportworld/datamap/list',
    method: 'get',
    params: query
  })
}

// 查询报表世界数据地图详细
export function getDatamap(data) {
  return request({
    url: '/reportworld/datamap/getDatamap',
    method: 'post',
    data: data
  })
}

// 新增报表世界数据地图
export function addDatamap(data) {
  return request({
    url: '/reportworld/datamap',
    method: 'post',
    data: data
  })
}

// 修改报表世界数据地图
export function updateDatamap(data) {
  return request({
    url: '/reportworld/datamap',
    method: 'put',
    data: data
  })
}

// 删除报表世界数据地图
export function delDatamap(idList, hisVersion) {
  const data = {
    idList,
    hisVersion
  };
  return request({
    url: '/reportworld/datamap/remove',
    method: 'post',
    data: data
  })
}


// 初始化查询
export function init(data) {
  return request({
    url: '/reportworld/datamap/init',
    method: 'post',
    data: data
  })
}

// 获取字段信息
export function getTableDetailByTableName(tableName,hisVersion) {
  const data = {
    tableName,
    hisVersion
  };
  return request({
    url: '/reportworld/datamap/getTableDetailByTableName/',
    method: 'post',
    data: data
  })
}

/**
 * 获取思维导图
 * @param tableName
 */
export function getDataMapImg(tableName,hisVersion) {
  const data = {
    tableName,
    hisVersion
  };
  return request({
    url: '/reportworld/datamap/getDataMapImg/',
    method: 'post',
    data: data
  })
}


/**
 * @param
 */
export function getDatamapInfoBySql(hisVersion) {
  return request({
    url: '/reportworld/datamap/getDatamapInfoBySql/' + hisVersion,
    method: 'get'
  })
}
